import { reqCategory3List } from "@/api/goods/attr";
import { ICateOne } from "@/types/attr";
import { createSlice } from "@reduxjs/toolkit";

const threeSlice=createSlice({
    name:'categoryThree',
    initialState:{
        value:[] as ICateOne[]
    },
    reducers:{
        addThreddCate:(state,{payload})=>{
            state.value=payload
        }
    }
})
let {addThreddCate}=threeSlice.actions


export const getCateThree=(category2Id: string)=>{
    return async (dispath:any)=>{
     const res=   await reqCategory3List(category2Id)
     if(res.code===200){
    dispath(addThreddCate(res.data))
     }
    }
}

export default threeSlice.reducer